A program executed on a processor comprises multiple types of instructions, such as subroutine call and link instructions.
A subroutine call and link instruction is an instruction that jumps to a subroutine (a section of code to perform a specific task) at a call destination address, and, after the subroutine has been executed, returns to the calling point. In particular the last instruction of the subroutine is a return instruction which directs the processor to return to the calling point and start executing instructions. Accordingly, a subroutine can only be called by an instruction that stores a link back to the main program.
Instructions in a program can be more efficiently fetched if the fetch unit of the processor takes into account the relationship between the call and link instruction and the corresponding subroutine return instruction.
The embodiments described below are provided by way of example only and are not limiting of implementations which solve any or all of the disadvantages of known processor fetch units.